package logic

import (
	"context"
	"month/videosvr/video"

	"month/client/internal/svc"
	"month/client/internal/types"

	"github.com/zeromicro/go-zero/core/logx"
)

type CommentLikeLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

func NewCommentLikeLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CommentLikeLogic {
	return &CommentLikeLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *CommentLikeLogic) CommentLike(req *types.CommentLikeReq) (resp *types.Res, err error) {
	// todo: add your logic here and delete this line
	_, err = l.svcCtx.VideoRpc.CommentLike(l.ctx, &video.CommentLikeReq{
		CommentId: req.Id,
		Userid:    req.Userid,
	})
	if err != nil {
		return &types.Res{
			Code: -1,
			Msg:  err.Error(),
			Data: nil,
		}, nil
	}
	return &types.Res{
		Code: 200,
		Msg:  "success",
		Data: nil,
	}, nil
}
